<me:SDBASE x:Class="WPFExcelReport.K9317"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                     xmlns:me="clr-namespace:WPFExcelReport"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    xmlns:WF="clr-namespace:WPFExcelReport;assembly=TICC_WFEVENTS"  
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:SDBASE.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:TextTrimmingConverter x:Key="trim"/>
    </me:SDBASE.Resources>
    <WrapPanel>
        <WF:TBTNEXE IsManage="{Binding IsManage,ElementName=TV}" DLL="TSDDAT" CMD="TSD02" STWNW="MainWindow" KRS="{Binding SDSA,ElementName=TV}"
                      />
        <ComboBox   DropDownOpened="ComboBox_DropDownOpened" 
            Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"
             Width="Auto"  
             SelectedValuePath="KEY"
             DisplayMemberPath="DES"
             ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
             IsSynchronizedWithCurrentItem="True" 
             ScrollViewer.HorizontalScrollBarVisibility="Visible"
            >
        </ComboBox>
        <ListBox    ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}"  
                     Visibility="{Binding IsCombo,ElementName=TV,Converter={StaticResource nbv}}"
                                ScrollViewer.CanContentScroll="True">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel  />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate> 
                        <Border Margin="4,2,2,2" Grid.Column="2" BorderThickness="2" CornerRadius="4"> 
                            <Border.BorderBrush>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="#aaa" Offset="0" />
                                    <GradientStop Color="#222" Offset="1" />
                                </LinearGradientBrush>
                            </Border.BorderBrush>
                        <Grid Width="40">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                            <TextBlock Grid.Row="0" Text="{Binding Path=SDES}"  Height="40" Width="40" TextAlignment ="Center"/>
                        </Grid>
                        </Border>  
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox> 
    </WrapPanel>
</me:SDBASE>
